﻿
#ifndef _RGB_YCBCR_INCLUDE_H_
#define _RGB_YCBCR_INCLUDE_H_


#ifdef __cplusplus
extern "C"
{
#endif

// #include "base_type.h"

#define BLUE    1
#define RED     6
#define YELLOW  10

#ifndef DLL_API
	#define DLL_API		
#endif

//颜色语义类别

//	{0,   0,   0},   //black
//	{0,   0,   255}, //blue
//	{128, 102, 64},  //brown
//	{128, 128, 128}, //grey
//	{0,   255, 0},   //green
//	{255, 204, 0},   //orange
//	{255, 128, 255}, //pink
//	{255, 0,   255}, //purple
//	{255, 0,   0},   //red
//	{255, 255, 255}, //white
//	{255, 255, 0 }   //yellow
//

extern unsigned char cbcr_color_map[];

static int rgb2ycbcr_offset[3] = {16777216, 134217728, 134217728};
static int ycbcr2rgb_offset[3] = {-233749610, 142169604, -290275197};

static int rgb2ycbcr_y_coef1[256] = {0, 269262, 538524, 807786, 1077048, 1346310, 1615572, 1884834, 2154096, 2423358, 2692620, 2961882, 3231144, 3500406, 3769668, 4038930, 4308192, 4577454, 4846716, 5115978, 5385240, 5654502, 5923764, 6193026, 6462288, 6731550, 7000812, 7270074, 7539336, 7808598, 8077860, 8347122, 8616384, 8885646, 9154908, 9424170, 9693432, 9962694, 10231956, 10501218, 10770480, 11039742, 11309004, 11578266, 11847528, 12116790, 12386052, 12655314, 12924576, 13193838, 13463100, 13732362, 14001624, 14270886, 14540148, 14809410, 15078672, 15347934, 15617196, 15886458, 16155720, 16424982, 16694244, 16963506, 17232768, 17502030, 17771292, 18040554, 18309816, 18579078, 18848340, 19117602, 19386864, 19656126, 19925388, 20194650, 20463912, 20733174, 21002436, 21271698, 21540960, 21810222, 22079484, 22348746, 22618008, 22887270, 23156532, 23425794, 23695056, 23964318, 24233580, 24502842, 24772104, 25041366, 25310628, 25579890, 25849152, 26118414, 26387676, 26656938, 26926200, 27195462, 27464724, 27733986, 28003248, 28272510, 28541772, 28811034, 29080296, 29349558, 29618820, 29888082, 30157344, 30426606, 30695868, 30965130, 31234392, 31503654, 31772916, 32042178, 32311440, 32580702, 32849964, 33119226, 33388488, 33657750, 33927012, 34196274, 34465536, 34734798, 35004060, 35273322, 35542584, 35811846, 36081108, 36350370, 36619632, 36888894, 37158156, 37427418, 37696680, 37965942, 38235204, 38504466, 38773728, 39042990, 39312252, 39581514, 39850776, 40120038, 40389300, 40658562, 40927824, 41197086, 41466348, 41735610, 42004872, 42274134, 42543396, 42812658, 43081920, 43351182, 43620444, 43889706, 44158968, 44428230, 44697492, 44966754, 45236016, 45505278, 45774540, 46043802, 46313064, 46582326, 46851588, 47120850, 47390112, 47659374, 47928636, 48197898, 48467160, 48736422, 49005684, 49274946, 49544208, 49813470, 50082732, 50351994, 50621256, 50890518, 51159780, 51429042, 51698304, 51967566, 52236828, 52506090, 52775352, 53044614, 53313876, 53583138, 53852400, 54121662, 54390924, 54660186, 54929448, 55198710, 55467972, 55737234, 56006496, 56275758, 56545020, 56814282, 57083544, 57352806, 57622068, 57891330, 58160592, 58429854, 58699116, 58968378, 59237640, 59506902, 59776164, 60045426, 60314688, 60583950, 60853212, 61122474, 61391736, 61660998, 61930260, 62199522, 62468784, 62738046, 63007308, 63276570, 63545832, 63815094, 64084356, 64353618, 64622880, 64892142, 65161404, 65430666, 65699928, 65969190, 66238452, 66507714, 66776976, 67046238, 67315500, 67584762, 67854024, 68123286, 68392548, 68661810};

static int rgb2ycbcr_y_coef2[256] = {0, 528618, 1057236, 1585854, 2114472, 2643090, 3171708, 3700326, 4228944, 4757562, 5286180, 5814798, 6343416, 6872034, 7400652, 7929270, 8457888, 8986506, 9515124, 10043742, 10572360, 11100978, 11629596, 12158214, 12686832, 13215450, 13744068, 14272686, 14801304, 15329922, 15858540, 16387158, 16915776, 17444394, 17973012, 18501630, 19030248, 19558866, 20087484, 20616102, 21144720, 21673338, 22201956, 22730574, 23259192, 23787810, 24316428, 24845046, 25373664, 25902282, 26430900, 26959518, 27488136, 28016754, 28545372, 29073990, 29602608, 30131226, 30659844, 31188462, 31717080, 32245698, 32774316, 33302934, 33831552, 34360170, 34888788, 35417406, 35946024, 36474642, 37003260, 37531878, 38060496, 38589114, 39117732, 39646350, 40174968, 40703586, 41232204, 41760822, 42289440, 42818058, 43346676, 43875294, 44403912, 44932530, 45461148, 45989766, 46518384, 47047002, 47575620, 48104238, 48632856, 49161474, 49690092, 50218710, 50747328, 51275946, 51804564, 52333182, 52861800, 53390418, 53919036, 54447654, 54976272, 55504890, 56033508, 56562126, 57090744, 57619362, 58147980, 58676598, 59205216, 59733834, 60262452, 60791070, 61319688, 61848306, 62376924, 62905542, 63434160, 63962778, 64491396, 65020014, 65548632, 66077250, 66605868, 67134486, 67663104, 68191722, 68720340, 69248958, 69777576, 70306194, 70834812, 71363430, 71892048, 72420666, 72949284, 73477902, 74006520, 74535138, 75063756, 75592374, 76120992, 76649610, 77178228, 77706846, 78235464, 78764082, 79292700, 79821318, 80349936, 80878554, 81407172, 81935790, 82464408, 82993026, 83521644, 84050262, 84578880, 85107498, 85636116, 86164734, 86693352, 87221970, 87750588, 88279206, 88807824, 89336442, 89865060, 90393678, 90922296, 91450914, 91979532, 92508150, 93036768, 93565386, 94094004, 94622622, 95151240, 95679858, 96208476, 96737094, 97265712, 97794330, 98322948, 98851566, 99380184, 99908802, 100437420, 100966038, 101494656, 102023274, 102551892, 103080510, 103609128, 104137746, 104666364, 105194982, 105723600, 106252218, 106780836, 107309454, 107838072, 108366690, 108895308, 109423926, 109952544, 110481162, 111009780, 111538398, 112067016, 112595634, 113124252, 113652870, 114181488, 114710106, 115238724, 115767342, 116295960, 116824578, 117353196, 117881814, 118410432, 118939050, 119467668, 119996286, 120524904, 121053522, 121582140, 122110758, 122639376, 123167994, 123696612, 124225230, 124753848, 125282466, 125811084, 126339702, 126868320, 127396938, 127925556, 128454174, 128982792, 129511410, 130040028, 130568646, 131097264, 131625882, 132154500, 132683118, 133211736, 133740354, 134268972, 134797590};

static int rgb2ycbcr_y_coef3[256] = {0, 102662, 205324, 307986, 410648, 513310, 615972, 718634, 821296, 923958, 1026620, 1129282, 1231944, 1334606, 1437268, 1539930, 1642592, 1745254, 1847916, 1950578, 2053240, 2155902, 2258564, 2361226, 2463888, 2566550, 2669212, 2771874, 2874536, 2977198, 3079860, 3182522, 3285184, 3387846, 3490508, 3593170, 3695832, 3798494, 3901156, 4003818, 4106480, 4209142, 4311804, 4414466, 4517128, 4619790, 4722452, 4825114, 4927776, 5030438, 5133100, 5235762, 5338424, 5441086, 5543748, 5646410, 5749072, 5851734, 5954396, 6057058, 6159720, 6262382, 6365044, 6467706, 6570368, 6673030, 6775692, 6878354, 6981016, 7083678, 7186340, 7289002, 7391664, 7494326, 7596988, 7699650, 7802312, 7904974, 8007636, 8110298, 8212960, 8315622, 8418284, 8520946, 8623608, 8726270, 8828932, 8931594, 9034256, 9136918, 9239580, 9342242, 9444904, 9547566, 9650228, 9752890, 9855552, 9958214, 10060876, 10163538, 10266200, 10368862, 10471524, 10574186, 10676848, 10779510, 10882172, 10984834, 11087496, 11190158, 11292820, 11395482, 11498144, 11600806, 11703468, 11806130, 11908792, 12011454, 12114116, 12216778, 12319440, 12422102, 12524764, 12627426, 12730088, 12832750, 12935412, 13038074, 13140736, 13243398, 13346060, 13448722, 13551384, 13654046, 13756708, 13859370, 13962032, 14064694, 14167356, 14270018, 14372680, 14475342, 14578004, 14680666, 14783328, 14885990, 14988652, 15091314, 15193976, 15296638, 15399300, 15501962, 15604624, 15707286, 15809948, 15912610, 16015272, 16117934, 16220596, 16323258, 16425920, 16528582, 16631244, 16733906, 16836568, 16939230, 17041892, 17144554, 17247216, 17349878, 17452540, 17555202, 17657864, 17760526, 17863188, 17965850, 18068512, 18171174, 18273836, 18376498, 18479160, 18581822, 18684484, 18787146, 18889808, 18992470, 19095132, 19197794, 19300456, 19403118, 19505780, 19608442, 19711104, 19813766, 19916428, 20019090, 20121752, 20224414, 20327076, 20429738, 20532400, 20635062, 20737724, 20840386, 20943048, 21045710, 21148372, 21251034, 21353696, 21456358, 21559020, 21661682, 21764344, 21867006, 21969668, 22072330, 22174992, 22277654, 22380316, 22482978, 22585640, 22688302, 22790964, 22893626, 22996288, 23098950, 23201612, 23304274, 23406936, 23509598, 23612260, 23714922, 23817584, 23920246, 24022908, 24125570, 24228232, 24330894, 24433556, 24536218, 24638880, 24741542, 24844204, 24946866, 25049528, 25152190, 25254852, 25357514, 25460176, 25562838, 25665500, 25768162, 25870824, 25973486, 26076148, 26178810};

static int rgb2ycbcr_cb_coef1[256] = {0, -155424, -310848, -466272, -621696, -777120, -932544, -1087968, -1243392, -1398816, -1554240, -1709664, -1865088, -2020512, -2175936, -2331360, -2486784, -2642208, -2797632, -2953056, -3108480, -3263904, -3419328, -3574752, -3730176, -3885600, -4041024, -4196448, -4351872, -4507296, -4662720, -4818144, -4973568, -5128992, -5284416, -5439840, -5595264, -5750688, -5906112, -6061536, -6216960, -6372384, -6527808, -6683232, -6838656, -6994080, -7149504, -7304928, -7460352, -7615776, -7771200, -7926624, -8082048, -8237472, -8392896, -8548320, -8703744, -8859168, -9014592, -9170016, -9325440, -9480864, -9636288, -9791712, -9947136, -10102560, -10257984, -10413408, -10568832, -10724256, -10879680, -11035104, -11190528, -11345952, -11501376, -11656800, -11812224, -11967648, -12123072, -12278496, -12433920, -12589344, -12744768, -12900192, -13055616, -13211040, -13366464, -13521888, -13677312, -13832736, -13988160, -14143584, -14299008, -14454432, -14609856, -14765280, -14920704, -15076128, -15231552, -15386976, -15542400, -15697824, -15853248, -16008672, -16164096, -16319520, -16474944, -16630368, -16785792, -16941216, -17096640, -17252064, -17407488, -17562912, -17718336, -17873760, -18029184, -18184608, -18340032, -18495456, -18650880, -18806304, -18961728, -19117152, -19272576, -19428000, -19583424, -19738848, -19894272, -20049696, -20205120, -20360544, -20515968, -20671392, -20826816, -20982240, -21137664, -21293088, -21448512, -21603936, -21759360, -21914784, -22070208, -22225632, -22381056, -22536480, -22691904, -22847328, -23002752, -23158176, -23313600, -23469024, -23624448, -23779872, -23935296, -24090720, -24246144, -24401568, -24556992, -24712416, -24867840, -25023264, -25178688, -25334112, -25489536, -25644960, -25800384, -25955808, -26111232, -26266656, -26422080, -26577504, -26732928, -26888352, -27043776, -27199200, -27354624, -27510048, -27665472, -27820896, -27976320, -28131744, -28287168, -28442592, -28598016, -28753440, -28908864, -29064288, -29219712, -29375136, -29530560, -29685984, -29841408, -29996832, -30152256, -30307680, -30463104, -30618528, -30773952, -30929376, -31084800, -31240224, -31395648, -31551072, -31706496, -31861920, -32017344, -32172768, -32328192, -32483616, -32639040, -32794464, -32949888, -33105312, -33260736, -33416160, -33571584, -33727008, -33882432, -34037856, -34193280, -34348704, -34504128, -34659552, -34814976, -34970400, -35125824, -35281248, -35436672, -35592096, -35747520, -35902944, -36058368, -36213792, -36369216, -36524640, -36680064, -36835488, -36990912, -37146336, -37301760, -37457184, -37612608, -37768032, -37923456, -38078880, -38234304, -38389728, -38545152, -38700576, -38856000, -39011424, -39166848, -39322272, -39477696, -39633120};

static int rgb2ycbcr_cb_coef2[256] = {0, -305127, -610254, -915381, -1220508, -1525635, -1830762, -2135889, -2441016, -2746143, -3051270, -3356397, -3661524, -3966651, -4271778, -4576905, -4882032, -5187159, -5492286, -5797413, -6102540, -6407667, -6712794, -7017921, -7323048, -7628175, -7933302, -8238429, -8543556, -8848683, -9153810, -9458937, -9764064, -10069191, -10374318, -10679445, -10984572, -11289699, -11594826, -11899953, -12205080, -12510207, -12815334, -13120461, -13425588, -13730715, -14035842, -14340969, -14646096, -14951223, -15256350, -15561477, -15866604, -16171731, -16476858, -16781985, -17087112, -17392239, -17697366, -18002493, -18307620, -18612747, -18917874, -19223001, -19528128, -19833255, -20138382, -20443509, -20748636, -21053763, -21358890, -21664017, -21969144, -22274271, -22579398, -22884525, -23189652, -23494779, -23799906, -24105033, -24410160, -24715287, -25020414, -25325541, -25630668, -25935795, -26240922, -26546049, -26851176, -27156303, -27461430, -27766557, -28071684, -28376811, -28681938, -28987065, -29292192, -29597319, -29902446, -30207573, -30512700, -30817827, -31122954, -31428081, -31733208, -32038335, -32343462, -32648589, -32953716, -33258843, -33563970, -33869097, -34174224, -34479351, -34784478, -35089605, -35394732, -35699859, -36004986, -36310113, -36615240, -36920367, -37225494, -37530621, -37835748, -38140875, -38446002, -38751129, -39056256, -39361383, -39666510, -39971637, -40276764, -40581891, -40887018, -41192145, -41497272, -41802399, -42107526, -42412653, -42717780, -43022907, -43328034, -43633161, -43938288, -44243415, -44548542, -44853669, -45158796, -45463923, -45769050, -46074177, -46379304, -46684431, -46989558, -47294685, -47599812, -47904939, -48210066, -48515193, -48820320, -49125447, -49430574, -49735701, -50040828, -50345955, -50651082, -50956209, -51261336, -51566463, -51871590, -52176717, -52481844, -52786971, -53092098, -53397225, -53702352, -54007479, -54312606, -54617733, -54922860, -55227987, -55533114, -55838241, -56143368, -56448495, -56753622, -57058749, -57363876, -57669003, -57974130, -58279257, -58584384, -58889511, -59194638, -59499765, -59804892, -60110019, -60415146, -60720273, -61025400, -61330527, -61635654, -61940781, -62245908, -62551035, -62856162, -63161289, -63466416, -63771543, -64076670, -64381797, -64686924, -64992051, -65297178, -65602305, -65907432, -66212559, -66517686, -66822813, -67127940, -67433067, -67738194, -68043321, -68348448, -68653575, -68958702, -69263829, -69568956, -69874083, -70179210, -70484337, -70789464, -71094591, -71399718, -71704845, -72009972, -72315099, -72620226, -72925353, -73230480, -73535607, -73840734, -74145861, -74450988, -74756115, -75061242, -75366369, -75671496, -75976623, -76281750, -76586877, -76892004, -77197131, -77502258, -77807385};

static int rgb2ycbcr_cb_coef3[256] = {0, 460551, 921102, 1381653, 1842204, 2302755, 2763306, 3223857, 3684408, 4144959, 4605510, 5066061, 5526612, 5987163, 6447714, 6908265, 7368816, 7829367, 8289918, 8750469, 9211020, 9671571, 10132122, 10592673, 11053224, 11513775, 11974326, 12434877, 12895428, 13355979, 13816530, 14277081, 14737632, 15198183, 15658734, 16119285, 16579836, 17040387, 17500938, 17961489, 18422040, 18882591, 19343142, 19803693, 20264244, 20724795, 21185346, 21645897, 22106448, 22566999, 23027550, 23488101, 23948652, 24409203, 24869754, 25330305, 25790856, 26251407, 26711958, 27172509, 27633060, 28093611, 28554162, 29014713, 29475264, 29935815, 30396366, 30856917, 31317468, 31778019, 32238570, 32699121, 33159672, 33620223, 34080774, 34541325, 35001876, 35462427, 35922978, 36383529, 36844080, 37304631, 37765182, 38225733, 38686284, 39146835, 39607386, 40067937, 40528488, 40989039, 41449590, 41910141, 42370692, 42831243, 43291794, 43752345, 44212896, 44673447, 45133998, 45594549, 46055100, 46515651, 46976202, 47436753, 47897304, 48357855, 48818406, 49278957, 49739508, 50200059, 50660610, 51121161, 51581712, 52042263, 52502814, 52963365, 53423916, 53884467, 54345018, 54805569, 55266120, 55726671, 56187222, 56647773, 57108324, 57568875, 58029426, 58489977, 58950528, 59411079, 59871630, 60332181, 60792732, 61253283, 61713834, 62174385, 62634936, 63095487, 63556038, 64016589, 64477140, 64937691, 65398242, 65858793, 66319344, 66779895, 67240446, 67700997, 68161548, 68622099, 69082650, 69543201, 70003752, 70464303, 70924854, 71385405, 71845956, 72306507, 72767058, 73227609, 73688160, 74148711, 74609262, 75069813, 75530364, 75990915, 76451466, 76912017, 77372568, 77833119, 78293670, 78754221, 79214772, 79675323, 80135874, 80596425, 81056976, 81517527, 81978078, 82438629, 82899180, 83359731, 83820282, 84280833, 84741384, 85201935, 85662486, 86123037, 86583588, 87044139, 87504690, 87965241, 88425792, 88886343, 89346894, 89807445, 90267996, 90728547, 91189098, 91649649, 92110200, 92570751, 93031302, 93491853, 93952404, 94412955, 94873506, 95334057, 95794608, 96255159, 96715710, 97176261, 97636812, 98097363, 98557914, 99018465, 99479016, 99939567, 100400118, 100860669, 101321220, 101781771, 102242322, 102702873, 103163424, 103623975, 104084526, 104545077, 105005628, 105466179, 105926730, 106387281, 106847832, 107308383, 107768934, 108229485, 108690036, 109150587, 109611138, 110071689, 110532240, 110992791, 111453342, 111913893, 112374444, 112834995, 113295546, 113756097, 114216648, 114677199, 115137750, 115598301, 116058852, 116519403, 116979954, 117440505};

static int rgb2ycbcr_cr_coef1[256] = {0, 460551, 921102, 1381653, 1842204, 2302755, 2763306, 3223857, 3684408, 4144959, 4605510, 5066061, 5526612, 5987163, 6447714, 6908265, 7368816, 7829367, 8289918, 8750469, 9211020, 9671571, 10132122, 10592673, 11053224, 11513775, 11974326, 12434877, 12895428, 13355979, 13816530, 14277081, 14737632, 15198183, 15658734, 16119285, 16579836, 17040387, 17500938, 17961489, 18422040, 18882591, 19343142, 19803693, 20264244, 20724795, 21185346, 21645897, 22106448, 22566999, 23027550, 23488101, 23948652, 24409203, 24869754, 25330305, 25790856, 26251407, 26711958, 27172509, 27633060, 28093611, 28554162, 29014713, 29475264, 29935815, 30396366, 30856917, 31317468, 31778019, 32238570, 32699121, 33159672, 33620223, 34080774, 34541325, 35001876, 35462427, 35922978, 36383529, 36844080, 37304631, 37765182, 38225733, 38686284, 39146835, 39607386, 40067937, 40528488, 40989039, 41449590, 41910141, 42370692, 42831243, 43291794, 43752345, 44212896, 44673447, 45133998, 45594549, 46055100, 46515651, 46976202, 47436753, 47897304, 48357855, 48818406, 49278957, 49739508, 50200059, 50660610, 51121161, 51581712, 52042263, 52502814, 52963365, 53423916, 53884467, 54345018, 54805569, 55266120, 55726671, 56187222, 56647773, 57108324, 57568875, 58029426, 58489977, 58950528, 59411079, 59871630, 60332181, 60792732, 61253283, 61713834, 62174385, 62634936, 63095487, 63556038, 64016589, 64477140, 64937691, 65398242, 65858793, 66319344, 66779895, 67240446, 67700997, 68161548, 68622099, 69082650, 69543201, 70003752, 70464303, 70924854, 71385405, 71845956, 72306507, 72767058, 73227609, 73688160, 74148711, 74609262, 75069813, 75530364, 75990915, 76451466, 76912017, 77372568, 77833119, 78293670, 78754221, 79214772, 79675323, 80135874, 80596425, 81056976, 81517527, 81978078, 82438629, 82899180, 83359731, 83820282, 84280833, 84741384, 85201935, 85662486, 86123037, 86583588, 87044139, 87504690, 87965241, 88425792, 88886343, 89346894, 89807445, 90267996, 90728547, 91189098, 91649649, 92110200, 92570751, 93031302, 93491853, 93952404, 94412955, 94873506, 95334057, 95794608, 96255159, 96715710, 97176261, 97636812, 98097363, 98557914, 99018465, 99479016, 99939567, 100400118, 100860669, 101321220, 101781771, 102242322, 102702873, 103163424, 103623975, 104084526, 104545077, 105005628, 105466179, 105926730, 106387281, 106847832, 107308383, 107768934, 108229485, 108690036, 109150587, 109611138, 110071689, 110532240, 110992791, 111453342, 111913893, 112374444, 112834995, 113295546, 113756097, 114216648, 114677199, 115137750, 115598301, 116058852, 116519403, 116979954, 117440505};

static int rgb2ycbcr_cr_coef2[256] = {0, -385654, -771308, -1156962, -1542616, -1928270, -2313924, -2699578, -3085232, -3470886, -3856540, -4242194, -4627848, -5013502, -5399156, -5784810, -6170464, -6556118, -6941772, -7327426, -7713080, -8098734, -8484388, -8870042, -9255696, -9641350, -10027004, -10412658, -10798312, -11183966, -11569620, -11955274, -12340928, -12726582, -13112236, -13497890, -13883544, -14269198, -14654852, -15040506, -15426160, -15811814, -16197468, -16583122, -16968776, -17354430, -17740084, -18125738, -18511392, -18897046, -19282700, -19668354, -20054008, -20439662, -20825316, -21210970, -21596624, -21982278, -22367932, -22753586, -23139240, -23524894, -23910548, -24296202, -24681856, -25067510, -25453164, -25838818, -26224472, -26610126, -26995780, -27381434, -27767088, -28152742, -28538396, -28924050, -29309704, -29695358, -30081012, -30466666, -30852320, -31237974, -31623628, -32009282, -32394936, -32780590, -33166244, -33551898, -33937552, -34323206, -34708860, -35094514, -35480168, -35865822, -36251476, -36637130, -37022784, -37408438, -37794092, -38179746, -38565400, -38951054, -39336708, -39722362, -40108016, -40493670, -40879324, -41264978, -41650632, -42036286, -42421940, -42807594, -43193248, -43578902, -43964556, -44350210, -44735864, -45121518, -45507172, -45892826, -46278480, -46664134, -47049788, -47435442, -47821096, -48206750, -48592404, -48978058, -49363712, -49749366, -50135020, -50520674, -50906328, -51291982, -51677636, -52063290, -52448944, -52834598, -53220252, -53605906, -53991560, -54377214, -54762868, -55148522, -55534176, -55919830, -56305484, -56691138, -57076792, -57462446, -57848100, -58233754, -58619408, -59005062, -59390716, -59776370, -60162024, -60547678, -60933332, -61318986, -61704640, -62090294, -62475948, -62861602, -63247256, -63632910, -64018564, -64404218, -64789872, -65175526, -65561180, -65946834, -66332488, -66718142, -67103796, -67489450, -67875104, -68260758, -68646412, -69032066, -69417720, -69803374, -70189028, -70574682, -70960336, -71345990, -71731644, -72117298, -72502952, -72888606, -73274260, -73659914, -74045568, -74431222, -74816876, -75202530, -75588184, -75973838, -76359492, -76745146, -77130800, -77516454, -77902108, -78287762, -78673416, -79059070, -79444724, -79830378, -80216032, -80601686, -80987340, -81372994, -81758648, -82144302, -82529956, -82915610, -83301264, -83686918, -84072572, -84458226, -84843880, -85229534, -85615188, -86000842, -86386496, -86772150, -87157804, -87543458, -87929112, -88314766, -88700420, -89086074, -89471728, -89857382, -90243036, -90628690, -91014344, -91399998, -91785652, -92171306, -92556960, -92942614, -93328268, -93713922, -94099576, -94485230, -94870884, -95256538, -95642192, -96027846, -96413500, -96799154, -97184808, -97570462, -97956116, -98341770};

static int rgb2ycbcr_cr_coef3[256] = {0, -74897, -149794, -224691, -299588, -374485, -449382, -524279, -599176, -674073, -748970, -823867, -898764, -973661, -1048558, -1123455, -1198352, -1273249, -1348146, -1423043, -1497940, -1572837, -1647734, -1722631, -1797528, -1872425, -1947322, -2022219, -2097116, -2172013, -2246910, -2321807, -2396704, -2471601, -2546498, -2621395, -2696292, -2771189, -2846086, -2920983, -2995880, -3070777, -3145674, -3220571, -3295468, -3370365, -3445262, -3520159, -3595056, -3669953, -3744850, -3819747, -3894644, -3969541, -4044438, -4119335, -4194232, -4269129, -4344026, -4418923, -4493820, -4568717, -4643614, -4718511, -4793408, -4868305, -4943202, -5018099, -5092996, -5167893, -5242790, -5317687, -5392584, -5467481, -5542378, -5617275, -5692172, -5767069, -5841966, -5916863, -5991760, -6066657, -6141554, -6216451, -6291348, -6366245, -6441142, -6516039, -6590936, -6665833, -6740730, -6815627, -6890524, -6965421, -7040318, -7115215, -7190112, -7265009, -7339906, -7414803, -7489700, -7564597, -7639494, -7714391, -7789288, -7864185, -7939082, -8013979, -8088876, -8163773, -8238670, -8313567, -8388464, -8463361, -8538258, -8613155, -8688052, -8762949, -8837846, -8912743, -8987640, -9062537, -9137434, -9212331, -9287228, -9362125, -9437022, -9511919, -9586816, -9661713, -9736610, -9811507, -9886404, -9961301, -10036198, -10111095, -10185992, -10260889, -10335786, -10410683, -10485580, -10560477, -10635374, -10710271, -10785168, -10860065, -10934962, -11009859, -11084756, -11159653, -11234550, -11309447, -11384344, -11459241, -11534138, -11609035, -11683932, -11758829, -11833726, -11908623, -11983520, -12058417, -12133314, -12208211, -12283108, -12358005, -12432902, -12507799, -12582696, -12657593, -12732490, -12807387, -12882284, -12957181, -13032078, -13106975, -13181872, -13256769, -13331666, -13406563, -13481460, -13556357, -13631254, -13706151, -13781048, -13855945, -13930842, -14005739, -14080636, -14155533, -14230430, -14305327, -14380224, -14455121, -14530018, -14604915, -14679812, -14754709, -14829606, -14904503, -14979400, -15054297, -15129194, -15204091, -15278988, -15353885, -15428782, -15503679, -15578576, -15653473, -15728370, -15803267, -15878164, -15953061, -16027958, -16102855, -16177752, -16252649, -16327546, -16402443, -16477340, -16552237, -16627134, -16702031, -16776928, -16851825, -16926722, -17001619, -17076516, -17151413, -17226310, -17301207, -17376104, -17451001, -17525898, -17600795, -17675692, -17750589, -17825486, -17900383, -17975280, -18050177, -18125074, -18199971, -18274868, -18349765, -18424662, -18499559, -18574456, -18649353, -18724250, -18799147, -18874044, -18948941, -19023838, -19098735};

static int ycbcr2rgb_coef_y[256] = {0, 1220962, 2441924, 3662886, 4883848, 6104810, 7325772, 8546734, 9767696, 10988658, 12209620, 13430582, 14651544, 15872506, 17093468, 18314430, 19535392, 20756354, 21977316, 23198278, 24419240, 25640202, 26861164, 28082126, 29303088, 30524050, 31745012, 32965974, 34186936, 35407898, 36628860, 37849822, 39070784, 40291746, 41512708, 42733670, 43954632, 45175594, 46396556, 47617518, 48838480, 50059442, 51280404, 52501366, 53722328, 54943290, 56164252, 57385214, 58606176, 59827138, 61048100, 62269062, 63490024, 64710986, 65931948, 67152910, 68373872, 69594834, 70815796, 72036758, 73257720, 74478682, 75699644, 76920606, 78141568, 79362530, 80583492, 81804454, 83025416, 84246378, 85467340, 86688302, 87909264, 89130226, 90351188, 91572150, 92793112, 94014074, 95235036, 96455998, 97676960, 98897922, 100118884, 101339846, 102560808, 103781770, 105002732, 106223694, 107444656, 108665618, 109886580, 111107542, 112328504, 113549466, 114770428, 115991390, 117212352, 118433314, 119654276, 120875238, 122096200, 123317162, 124538124, 125759086, 126980048, 128201010, 129421972, 130642934, 131863896, 133084858, 134305820, 135526782, 136747744, 137968706, 139189668, 140410630, 141631592, 142852554, 144073516, 145294478, 146515440, 147736402, 148957364, 150178326, 151399288, 152620250, 153841212, 155062174, 156283136, 157504098, 158725060, 159946022, 161166984, 162387946, 163608908, 164829870, 166050832, 167271794, 168492756, 169713718, 170934680, 172155642, 173376604, 174597566, 175818528, 177039490, 178260452, 179481414, 180702376, 181923338, 183144300, 184365262, 185586224, 186807186, 188028148, 189249110, 190470072, 191691034, 192911996, 194132958, 195353920, 196574882, 197795844, 199016806, 200237768, 201458730, 202679692, 203900654, 205121616, 206342578, 207563540, 208784502, 210005464, 211226426, 212447388, 213668350, 214889312, 216110274, 217331236, 218552198, 219773160, 220994122, 222215084, 223436046, 224657008, 225877970, 227098932, 228319894, 229540856, 230761818, 231982780, 233203742, 234424704, 235645666, 236866628, 238087590, 239308552, 240529514, 241750476, 242971438, 244192400, 245413362, 246634324, 247855286, 249076248, 250297210, 251518172, 252739134, 253960096, 255181058, 256402020, 257622982, 258843944, 260064906, 261285868, 262506830, 263727792, 264948754, 266169716, 267390678, 268611640, 269832602, 271053564, 272274526, 273495488, 274716450, 275937412, 277158374, 278379336, 279600298, 280821260, 282042222, 283263184, 284484146, 285705108, 286926070, 288147032, 289367994, 290588956, 291809918, 293030880, 294251842, 295472804, 296693766, 297914728, 299135690, 300356652, 301577614, 302798576, 304019538, 305240500, 306461462, 307682424, 308903386, 310124348, 311345310};

static int ycbcr2rgb_r_coef_cr[256] = {0, 1673527, 3347054, 5020581, 6694108, 8367635, 10041162, 11714689, 13388216, 15061743, 16735270, 18408797, 20082324, 21755851, 23429378, 25102905, 26776432, 28449959, 30123486, 31797013, 33470540, 35144067, 36817594, 38491121, 40164648, 41838175, 43511702, 45185229, 46858756, 48532283, 50205810, 51879337, 53552864, 55226391, 56899918, 58573445, 60246972, 61920499, 63594026, 65267553, 66941080, 68614607, 70288134, 71961661, 73635188, 75308715, 76982242, 78655769, 80329296, 82002823, 83676350, 85349877, 87023404, 88696931, 90370458, 92043985, 93717512, 95391039, 97064566, 98738093, 100411620, 102085147, 103758674, 105432201, 107105728, 108779255, 110452782, 112126309, 113799836, 115473363, 117146890, 118820417, 120493944, 122167471, 123840998, 125514525, 127188052, 128861579, 130535106, 132208633, 133882160, 135555687, 137229214, 138902741, 140576268, 142249795, 143923322, 145596849, 147270376, 148943903, 150617430, 152290957, 153964484, 155638011, 157311538, 158985065, 160658592, 162332119, 164005646, 165679173, 167352700, 169026227, 170699754, 172373281, 174046808, 175720335, 177393862, 179067389, 180740916, 182414443, 184087970, 185761497, 187435024, 189108551, 190782078, 192455605, 194129132, 195802659, 197476186, 199149713, 200823240, 202496767, 204170294, 205843821, 207517348, 209190875, 210864402, 212537929, 214211456, 215884983, 217558510, 219232037, 220905564, 222579091, 224252618, 225926145, 227599672, 229273199, 230946726, 232620253, 234293780, 235967307, 237640834, 239314361, 240987888, 242661415, 244334942, 246008469, 247681996, 249355523, 251029050, 252702577, 254376104, 256049631, 257723158, 259396685, 261070212, 262743739, 264417266, 266090793, 267764320, 269437847, 271111374, 272784901, 274458428, 276131955, 277805482, 279479009, 281152536, 282826063, 284499590, 286173117, 287846644, 289520171, 291193698, 292867225, 294540752, 296214279, 297887806, 299561333, 301234860, 302908387, 304581914, 306255441, 307928968, 309602495, 311276022, 312949549, 314623076, 316296603, 317970130, 319643657, 321317184, 322990711, 324664238, 326337765, 328011292, 329684819, 331358346, 333031873, 334705400, 336378927, 338052454, 339725981, 341399508, 343073035, 344746562, 346420089, 348093616, 349767143, 351440670, 353114197, 354787724, 356461251, 358134778, 359808305, 361481832, 363155359, 364828886, 366502413, 368175940, 369849467, 371522994, 373196521, 374870048, 376543575, 378217102, 379890629, 381564156, 383237683, 384911210, 386584737, 388258264, 389931791, 391605318, 393278845, 394952372, 396625899, 398299426, 399972953, 401646480, 403320007, 404993534, 406667061, 408340588, 410014115, 411687642, 413361169, 415034696, 416708223, 418381750, 420055277, 421728804, 423402331, 425075858, 426749385};

static int ycbcr2rgb_g_coef_cb[256] = {0, -410832, -821664, -1232496, -1643328, -2054160, -2464992, -2875824, -3286656, -3697488, -4108320, -4519152, -4929984, -5340816, -5751648, -6162480, -6573312, -6984144, -7394976, -7805808, -8216640, -8627472, -9038304, -9449136, -9859968, -10270800, -10681632, -11092464, -11503296, -11914128, -12324960, -12735792, -13146624, -13557456, -13968288, -14379120, -14789952, -15200784, -15611616, -16022448, -16433280, -16844112, -17254944, -17665776, -18076608, -18487440, -18898272, -19309104, -19719936, -20130768, -20541600, -20952432, -21363264, -21774096, -22184928, -22595760, -23006592, -23417424, -23828256, -24239088, -24649920, -25060752, -25471584, -25882416, -26293248, -26704080, -27114912, -27525744, -27936576, -28347408, -28758240, -29169072, -29579904, -29990736, -30401568, -30812400, -31223232, -31634064, -32044896, -32455728, -32866560, -33277392, -33688224, -34099056, -34509888, -34920720, -35331552, -35742384, -36153216, -36564048, -36974880, -37385712, -37796544, -38207376, -38618208, -39029040, -39439872, -39850704, -40261536, -40672368, -41083200, -41494032, -41904864, -42315696, -42726528, -43137360, -43548192, -43959024, -44369856, -44780688, -45191520, -45602352, -46013184, -46424016, -46834848, -47245680, -47656512, -48067344, -48478176, -48889008, -49299840, -49710672, -50121504, -50532336, -50943168, -51354000, -51764832, -52175664, -52586496, -52997328, -53408160, -53818992, -54229824, -54640656, -55051488, -55462320, -55873152, -56283984, -56694816, -57105648, -57516480, -57927312, -58338144, -58748976, -59159808, -59570640, -59981472, -60392304, -60803136, -61213968, -61624800, -62035632, -62446464, -62857296, -63268128, -63678960, -64089792, -64500624, -64911456, -65322288, -65733120, -66143952, -66554784, -66965616, -67376448, -67787280, -68198112, -68608944, -69019776, -69430608, -69841440, -70252272, -70663104, -71073936, -71484768, -71895600, -72306432, -72717264, -73128096, -73538928, -73949760, -74360592, -74771424, -75182256, -75593088, -76003920, -76414752, -76825584, -77236416, -77647248, -78058080, -78468912, -78879744, -79290576, -79701408, -80112240, -80523072, -80933904, -81344736, -81755568, -82166400, -82577232, -82988064, -83398896, -83809728, -84220560, -84631392, -85042224, -85453056, -85863888, -86274720, -86685552, -87096384, -87507216, -87918048, -88328880, -88739712, -89150544, -89561376, -89972208, -90383040, -90793872, -91204704, -91615536, -92026368, -92437200, -92848032, -93258864, -93669696, -94080528, -94491360, -94902192, -95313024, -95723856, -96134688, -96545520, -96956352, -97367184, -97778016, -98188848, -98599680, -99010512, -99421344, -99832176, -100243008, -100653840, -101064672, -101475504, -101886336, -102297168, -102708000, -103118832, -103529664, -103940496, -104351328, -104762160};

static int ycbcr2rgb_g_coef_cr[256] = {0, -852492, -1704984, -2557476, -3409968, -4262460, -5114952, -5967444, -6819936, -7672428, -8524920, -9377412, -10229904, -11082396, -11934888, -12787380, -13639872, -14492364, -15344856, -16197348, -17049840, -17902332, -18754824, -19607316, -20459808, -21312300, -22164792, -23017284, -23869776, -24722268, -25574760, -26427252, -27279744, -28132236, -28984728, -29837220, -30689712, -31542204, -32394696, -33247188, -34099680, -34952172, -35804664, -36657156, -37509648, -38362140, -39214632, -40067124, -40919616, -41772108, -42624600, -43477092, -44329584, -45182076, -46034568, -46887060, -47739552, -48592044, -49444536, -50297028, -51149520, -52002012, -52854504, -53706996, -54559488, -55411980, -56264472, -57116964, -57969456, -58821948, -59674440, -60526932, -61379424, -62231916, -63084408, -63936900, -64789392, -65641884, -66494376, -67346868, -68199360, -69051852, -69904344, -70756836, -71609328, -72461820, -73314312, -74166804, -75019296, -75871788, -76724280, -77576772, -78429264, -79281756, -80134248, -80986740, -81839232, -82691724, -83544216, -84396708, -85249200, -86101692, -86954184, -87806676, -88659168, -89511660, -90364152, -91216644, -92069136, -92921628, -93774120, -94626612, -95479104, -96331596, -97184088, -98036580, -98889072, -99741564, -100594056, -101446548, -102299040, -103151532, -104004024, -104856516, -105709008, -106561500, -107413992, -108266484, -109118976, -109971468, -110823960, -111676452, -112528944, -113381436, -114233928, -115086420, -115938912, -116791404, -117643896, -118496388, -119348880, -120201372, -121053864, -121906356, -122758848, -123611340, -124463832, -125316324, -126168816, -127021308, -127873800, -128726292, -129578784, -130431276, -131283768, -132136260, -132988752, -133841244, -134693736, -135546228, -136398720, -137251212, -138103704, -138956196, -139808688, -140661180, -141513672, -142366164, -143218656, -144071148, -144923640, -145776132, -146628624, -147481116, -148333608, -149186100, -150038592, -150891084, -151743576, -152596068, -153448560, -154301052, -155153544, -156006036, -156858528, -157711020, -158563512, -159416004, -160268496, -161120988, -161973480, -162825972, -163678464, -164530956, -165383448, -166235940, -167088432, -167940924, -168793416, -169645908, -170498400, -171350892, -172203384, -173055876, -173908368, -174760860, -175613352, -176465844, -177318336, -178170828, -179023320, -179875812, -180728304, -181580796, -182433288, -183285780, -184138272, -184990764, -185843256, -186695748, -187548240, -188400732, -189253224, -190105716, -190958208, -191810700, -192663192, -193515684, -194368176, -195220668, -196073160, -196925652, -197778144, -198630636, -199483128, -200335620, -201188112, -202040604, -202893096, -203745588, -204598080, -205450572, -206303064, -207155556, -208008048, -208860540, -209713032, -210565524, -211418016, -212270508, -213123000, -213975492, -214827984, -215680476, -216532968, -217385460};

static int ycbcr2rgb_b_coef_cb[256] = {0, 2115188, 4230376, 6345564, 8460752, 10575940, 12691128, 14806316, 16921504, 19036692, 21151880, 23267068, 25382256, 27497444, 29612632, 31727820, 33843008, 35958196, 38073384, 40188572, 42303760, 44418948, 46534136, 48649324, 50764512, 52879700, 54994888, 57110076, 59225264, 61340452, 63455640, 65570828, 67686016, 69801204, 71916392, 74031580, 76146768, 78261956, 80377144, 82492332, 84607520, 86722708, 88837896, 90953084, 93068272, 95183460, 97298648, 99413836, 101529024, 103644212, 105759400, 107874588, 109989776, 112104964, 114220152, 116335340, 118450528, 120565716, 122680904, 124796092, 126911280, 129026468, 131141656, 133256844, 135372032, 137487220, 139602408, 141717596, 143832784, 145947972, 148063160, 150178348, 152293536, 154408724, 156523912, 158639100, 160754288, 162869476, 164984664, 167099852, 169215040, 171330228, 173445416, 175560604, 177675792, 179790980, 181906168, 184021356, 186136544, 188251732, 190366920, 192482108, 194597296, 196712484, 198827672, 200942860, 203058048, 205173236, 207288424, 209403612, 211518800, 213633988, 215749176, 217864364, 219979552, 222094740, 224209928, 226325116, 228440304, 230555492, 232670680, 234785868, 236901056, 239016244, 241131432, 243246620, 245361808, 247476996, 249592184, 251707372, 253822560, 255937748, 258052936, 260168124, 262283312, 264398500, 266513688, 268628876, 270744064, 272859252, 274974440, 277089628, 279204816, 281320004, 283435192, 285550380, 287665568, 289780756, 291895944, 294011132, 296126320, 298241508, 300356696, 302471884, 304587072, 306702260, 308817448, 310932636, 313047824, 315163012, 317278200, 319393388, 321508576, 323623764, 325738952, 327854140, 329969328, 332084516, 334199704, 336314892, 338430080, 340545268, 342660456, 344775644, 346890832, 349006020, 351121208, 353236396, 355351584, 357466772, 359581960, 361697148, 363812336, 365927524, 368042712, 370157900, 372273088, 374388276, 376503464, 378618652, 380733840, 382849028, 384964216, 387079404, 389194592, 391309780, 393424968, 395540156, 397655344, 399770532, 401885720, 404000908, 406116096, 408231284, 410346472, 412461660, 414576848, 416692036, 418807224, 420922412, 423037600, 425152788, 427267976, 429383164, 431498352, 433613540, 435728728, 437843916, 439959104, 442074292, 444189480, 446304668, 448419856, 450535044, 452650232, 454765420, 456880608, 458995796, 461110984, 463226172, 465341360, 467456548, 469571736, 471686924, 473802112, 475917300, 478032488, 480147676, 482262864, 484378052, 486493240, 488608428, 490723616, 492838804, 494953992, 497069180, 499184368, 501299556, 503414744, 505529932, 507645120, 509760308, 511875496, 513990684, 516105872, 518221060, 520336248, 522451436, 524566624, 526681812, 528797000, 530912188, 533027376, 535142564, 537257752, 539372940};


#define COLOR_CVT_SHIFT_BIT      (20)
#define COLOR_CVT_MAX_SHIFT_VAL  (255 << COLOR_CVT_SHIFT_BIT)
#define COLOR_CVT_MAX_SHIFT_HALF (1 << (COLOR_CVT_SHIFT_BIT - 1))

//input should be int
#define RGB2YCbCr(r, g, b, y, cb, cr) \
{                                                                                           \
	y  = rgb2ycbcr_y_coef1[r]  + rgb2ycbcr_y_coef2[g]  + rgb2ycbcr_y_coef3[b]  + 16777216;  \
	cb = rgb2ycbcr_cb_coef1[r] + rgb2ycbcr_cb_coef2[g] + rgb2ycbcr_cb_coef3[b] + 134217728; \
	cr = rgb2ycbcr_cr_coef1[r] + rgb2ycbcr_cr_coef2[g] + rgb2ycbcr_cr_coef3[b] + 134217728; \
	y  = y  >> COLOR_CVT_SHIFT_BIT;                                                         \
	cb = cb >> COLOR_CVT_SHIFT_BIT;                                                         \
	cr = cr >> COLOR_CVT_SHIFT_BIT;                                                         \
	cb = cb < 0 ? 0 : (cb);                                                                 \
	cr = cr < 0 ? 0 : (cr);                                                                 \
}

//input should be int
#define YCbCr2RGB(y, cb, cr, r, g, b) \
{                                                                                          \
	int coef_y = ycbcr2rgb_coef_y[y];                                                      \
	int nR = coef_y + ycbcr2rgb_r_coef_cr[cr] - 233749610;                                 \
	int nG = coef_y + ycbcr2rgb_g_coef_cb[cb] + ycbcr2rgb_g_coef_cr[cr] + 142169604;       \
	int nB = coef_y + ycbcr2rgb_b_coef_cb[cb] - 290275197;                                 \
	nR = nR < 0 ? 0 : nR;                                                                  \
	nR = nR > COLOR_CVT_MAX_SHIFT_VAL ? COLOR_CVT_MAX_SHIFT_VAL : nR;                      \
	nG = nG < 0 ? 0 : nG;                                                                  \
	nG = nG > COLOR_CVT_MAX_SHIFT_VAL ? COLOR_CVT_MAX_SHIFT_VAL : nG;                      \
	nB = nB < 0 ? 0 : nB;                                                                  \
	nB = nB > COLOR_CVT_MAX_SHIFT_VAL ? COLOR_CVT_MAX_SHIFT_VAL : nB;                      \
	(r) = (nR + COLOR_CVT_MAX_SHIFT_HALF) >> COLOR_CVT_SHIFT_BIT;                          \
	(g) = (nG + COLOR_CVT_MAX_SHIFT_HALF) >> COLOR_CVT_SHIFT_BIT;                          \
	(b) = (nB + COLOR_CVT_MAX_SHIFT_HALF) >> COLOR_CVT_SHIFT_BIT;                          \
}


/******************************************************************************
* 功  能：将RGB图像存储方式为 BGR BGR BGR BGR 的数据帧转换为存储方式为 YCbCr YCbCr YCbCr YCbCr 的数据帧

* 要  求：输入RGB数据的存储方式为：   BGR BGR BGR BGR
*         输出YCbCr数据的存储方式为： YCbCr YCbCr YCbCr YCbCr

* 备  注：输入和输出的图像尺寸大小和占用内存相等，图像宽高的尺度没有必须为偶数或一定要为四字节对齐的要求         

* 返回值：
******************************************************************************/
DLL_API  void bgr2ycbcr(unsigned char *prgb, unsigned char *pycbcr, int image_w, int image_h);

/******************************************************************************
* 功  能：将YCbCr图像存储方式为  YCbCr YCbCr YCbCr YCbCr 的数据帧转换为RGB图像

* 要  求：输入YCbCr数据的存储方式为： YCbCr YCbCr YCbCr YCbCr
*         输出RGB数据的存储方式为：   BGR BGR BGR BGR

* 备  注：输入和输出的图像尺寸大小和占用内存相等，图像宽高的尺度没有必须为偶数或一定要为四字节对齐的要求         

* 返回值：
******************************************************************************/
DLL_API  void ycbcr2bgr(unsigned char *pycbcr, unsigned char *prgb, int image_w, int image_h);

/******************************************************************************
* 功  能：将RGB图像存储方式为 BGR BGR BGR BGR 的数据帧转换为存储方式为 YYYY YYYY CbCb CrCr 的数据帧

* 要  求：输入RGB数据的存储方式为：   BGR BGR BGR BGR
*         输出YCbCr数据的存储方式为： YYYY YYYY CbCb CrCr

* 备  注：输入图像宽高需要为偶数        

* 返回值：
******************************************************************************/
DLL_API  void bgr2ycbcr420(unsigned char *prgb, unsigned char *pycbcr, int image_w, int image_h);

/******************************************************************************
* 功  能：将YCbCr420图像存储方式为  YYYY YYYY CbCb CrCr 的数据帧转换为RGB图像

* 要  求：输入YCbCr420数据的存储方式为： YYYY YYYY CbCb CrCr
*         输出RGB数据的存储方式为：      BGR BGR BGR BGR

* 备  注：输入图像宽需要为偶数         

* 返回值：
******************************************************************************/
DLL_API  void ycbcr420_to_bgr(unsigned char *pycbcr, unsigned char *prgb, int image_w, int image_h);


#ifdef __cplusplus
}
#endif

#endif
